package third;

import java.util.Scanner;

public class third_28 {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
		System.out.print("Enter r1's center x-, y-coordinates, width, and height:");
		double r1x, r2x, r1y ,r2y, r1d, r2d, r1l, r2l;
		r1x = input.nextDouble();
		r1y = input.nextDouble();
		r1d = input.nextDouble();
		r1l = input.nextDouble();
		System.out.print("Enter r1's center x-, y-coordinates, width, and height:");
		r2x = input.nextDouble();
		r2y = input.nextDouble();
		r2d = input.nextDouble();
		r2l = input.nextDouble();

		if(r2x-r2d>=r1x-r1d&&r2x+r2d<=r1x+r2d&&r2y+r2l<=r1y+r1l&&r2y-r2l>=r1y-r1l) {
			System.out.println("R2 is inside r1");
		}
		else if(r2x-r2d>=r1x+r1d||r2x+r2d<=r1x-r2d||r2y+r2l<=r1y-r1l||r2y-r2l>=r1y+r1l) {
			System.out.println("r2 does not overlap r1");
		}
		else {
			System.out.println("r2 overlaps r1");
		}
    }
}
